Stop the suite leaving foreign buffers current - #2175
Open
bbatsov wants to merge 1 commit into
Open
Conversation
A spec that switches buffers without putting the old one back leaves it current for everything that runs after it. Most specs don't care, so such a leak sits unnoticed until one that reads ambient buffer state runs next and fails - which is how `projectile-default-compilation-command' (it asserts on `(point)') started failing on Emacs 30.2 and nowhere else. `dev/buffer-leaks.el' reported eleven of them. The fix is in three places rather than eleven: `projectile-test-with-sandbox' now restores the current buffer, which covers everything built on it; the session specs remember and restore around each spec, since they lay out windows and rearrange tabs on purpose; and one switch spec was resolving a relative file name after `switch-to-buffer' had already changed `default-directory' out from under it, so it now resolves the path up front. Zero leaks reported after this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A spec that switches buffers without putting the old one back leaves it current for everything after it. Most specs don't care, so the leak sits unnoticed until one that reads ambient buffer state runs next and fails - which is exactly how
projectile-default-compilation-command(it asserts on(point)) started failing on Emacs 30.2 and nowhere else earlier this week.dev/buffer-leaks.elreported eleven. The fix is in three places rather than eleven:projectile-test-with-sandboxrestores the current buffer, covering everything built on itswitch-to-bufferhad changeddefault-directoryunder it, and was passing only by accident of ambient state - it now resolves the path up frontZero leaks reported after this, suite still 1518 green.